"use strict";

// var baseUrl =
//   process.env.NODE_ENV == "development"
//     ? "http://192.168.0.12:12015/wycms-api"
//     : "/wycms-api";
if (!Array.prototype.indexOf) {
  Array.prototype.indexOf = function (elt) {
    var len = this.length >>> 0;
    var from = Number(arguments[1]) || 0;
    from = from < 0 ? Math.ceil(from) : Math.floor(from);
    if (from < 0) from += len;
    for (; from < len; from++) {
      if (from in this && this[from] === elt) return from;
    }
    return -1;
  };
}
var baseUrl = "/wycms-api";
var firstEnergyStateDetail = {};
function handleResponse(res) {
  firstEnergyStateDetail = res.data;
  var s = "";
  s += "<marquee scrollamount=\"1\" direction=\"up\" width=\"100%\" height=\"70\" onMouseOver=\"this.stop();\"\n      onMouseOut=\"this.start();\">\n      <span>\n        <p class=\"title\">电网运行情况</p>";
  s += "<p class=\"item\">\n          <span class=\"left\">今日日期：</span>\n          <span class=\"right\">".concat(firstEnergyStateDetail.times, "</span>\n        </p>");
  s += "\n        <p class=\"item\">\n          <span class=\"left\">".concat(["yc", "jc"].indexOf(city_name) > -1 ? "网供指标" : ["ll"].indexOf(city_name) > -1 ? "网供最大负荷" : "", "</span>\n          <span class=\"right\">").concat(firstEnergyStateDetail.netTarget, "万千瓦</span>\n        </p>\n        ");
  s += "\n         <p class=\"item\">\n          <span class=\"left\">".concat(["yc", "jc"].indexOf(city_name) > -1 ? "网供电量" : ["ll"].indexOf(city_name) > -1 ? "供电量" : "", "</span>\n          <span class=\"right\">").concat(firstEnergyStateDetail.netEnergy, "万千瓦时</span>\n        </p>\n        ");
  s += "<p class=\"item\">\n          <span class=\"left\">".concat(["yc", "jc"].indexOf(city_name) > -1 ? "最大网供负荷" : ["ll"].indexOf(city_name) > -1 ? "网供最小负荷" : "", "</span>\n          <span class=\"right\">").concat(firstEnergyStateDetail.maxNetLoad, "万千瓦</span>\n        </p>");
  if (["yc", "jc"].indexOf(city_name) > -1) {
    s += "<p class=\"item\">\n          <span class=\"left\">整点最大负荷</span>\n          <span class=\"right\">".concat(firstEnergyStateDetail.maxPointLoad, "万千瓦</span>\n        </p>");
  }
  if (["yc", "jc"].indexOf(city_name) > -1) {
    s += "<p class=\"item\">\n          <span class=\"left\">整点最小负荷</span>\n          <span class=\"right\">".concat(firstEnergyStateDetail.minPointLoad, "万千瓦</span>\n        </p>");
  }
  if (["yc", "jc"].indexOf(city_name) > -1) {
    s += "<p class=\"item\">\n          <span class=\"left\">限电最大负荷</span>\n          <span class=\"right\">".concat(firstEnergyStateDetail.limitMaxLoad, "万千瓦</span>\n        </p>");
  }
  if (["yc", "jc"].indexOf(city_name) > -1) {
    s += "<p class=\"item\">\n          <span class=\"left\">拉路条次</span>\n          <span class=\"right\">".concat(firstEnergyStateDetail.cutNum, "万千瓦</span>\n        </p>");
  }
  if (["yc", "jc"].indexOf(city_name) > -1) {
    s += "<p class=\"item\">\n          <span class=\"left\">限电损失</span>\n          <span class=\"right\">".concat(firstEnergyStateDetail.cutLosing, "万千瓦</span>\n        </p>");
  }
  if (["jc"].indexOf(city_name) > -1) {
    s += "<p class=\"item\">\n          <span class=\"left\">全区最大负荷</span>\n          <span class=\"right\">".concat(firstEnergyStateDetail.zdfh, "万千瓦</span>\n        </p>");
  }
  if (["ll"].indexOf(city_name) > -1) {
    s += "<p class=\"item\">\n          <span class=\"left\">发电量</span>\n          <span class=\"right\">".concat(firstEnergyStateDetail.netFaDian, "万千瓦</span>\n        </p>");
  }
  if (["ll"].indexOf(city_name) > -1) {
    s += "<p class=\"item\">\n          <span class=\"left\">峰谷率</span>\n          <span class=\"right\">".concat(firstEnergyStateDetail.netFengGu, "万千瓦</span>\n        </p>");
  }
  if (["ll"].indexOf(city_name) > -1) {
    s += "<p class=\"item\">\n          <span class=\"left\">负荷率</span>\n          <span class=\"right\">".concat(firstEnergyStateDetail.netLoadRate, "万千瓦</span>\n        </p>");
  }
  s += "</span></marquee>";
  $(".firstEnergyState").append(s);
}
function getEnergyStateDetail() {
  var query = getQuery();
  $.ajax({
    url: baseUrl + "/customize/energyState/index",
    method: "post",
    data: {
      siteId: query.siteId
    },
    success: handleResponse
  });
}
getEnergyStateDetail();